Skip to content

Optionally return the text around each tracked change - #64

Merged
aloth merged 2 commits into
aloth:mainfrom
fredericosantos:feat/change-surrounding-text
Nov 15, 2026
Merged

aloth merged 2 commits into
aloth:mainfrom
fredericosantos:feat/change-surrounding-text

Conversation

@fredericosantos

Copy link
Copy Markdown
Contributor

I'm using olcli as a library to show tracked changes inside a local git clone of the project (a VS Code extension). position only fits Overleaf's current copy of the doc. As soon as the local copy has edits the change doesn't know about, the offset is off, and there's nothing to find the change by. For a delete it's even worse, since the deleted text isn't in the file at all.

Change

listTrackedChanges and listReview take surroundingChars. With it, each change carries before and after: up to that many characters of the visible text right before the change and right after it (after the inserted text, for an insert). They come from the same visible text position refers to, so history-ot docs work the same way. Off by default, so olcli changes output and JSON stay as they are.

Tests

npm test goes from 240 to 241. The new test covers an insert and a delete in a sharejs-text-ot doc and a delete in a history-ot doc, and checks that nothing is added without the option. Lint is unchanged. CHANGELOG entry included.

What I haven't verified

  • Live, I've only used it with sharejs-text-ot docs (40 characters each side, then matching the text around a change in the local file). The history-ot case is only covered by the unit test.

fredericosantos and others added 2 commits November 13, 2026 18:41
surroundingChars on listTrackedChanges/listReview adds before/after, so a
caller can find a change again in an edited copy of the doc.
@aloth
aloth merged commit 791cfc9 into aloth:main Nov 15, 2026
2 checks passed
@aloth

aloth commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Thanks, merged. Since it is off by default, existing output and JSON stay the same. Ships in 0.17.0.

aloth added a commit that referenced this pull request Nov 15, 2026
Set version 0.17.0 in package.json, package-lock.json, CITATION.cff and server.json, and fold the Unreleased CHANGELOG entries of #63, #64, #65 and #67 into the 0.17.0 section dated 2026-11-15.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants